package com.gupao.study.composite;

public class Test {
    public static void main(String[] args) {
        //创建2个文件
        Component m1 = new Monomer("hello.java");
        Component m2 = new Monomer("index.html");

        //创建目录
        Composite root = new Composite("D:",1);
        Composite c2 = new Composite("我的文档",2);

        Composite c3 = new Composite("我的资料",3);
        c3.addComponent(m1);
        c3.addComponent(m2);

        //目录放到root
        root.addComponent(c2);
        root.addComponent(c3);

        root.print();
    }
}
